package com.ruoyi.wcf.controller;

import java.util.List;

import com.ruoyi.wcf.domain.WcfRegionManage;
import com.ruoyi.wcf.service.IWcfRegionManageService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfRegionManageInfo;
import com.ruoyi.wcf.service.IWcfRegionManageInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 功能区内容管理Controller
 *
 * @author LCL
 * @date 2022-04-06
 */
@RestController
@RequestMapping("/wcf/WcfRegionManageInfo")
public class WcfRegionManageInfoController extends BaseController
{
    @Autowired
    private IWcfRegionManageInfoService wcfRegionManageInfoService;
    @Autowired
    private IWcfRegionManageService wcfRegionManageService;

    /**
     * 查询功能区内容管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfRegionManageInfo wcfRegionManageInfo)
    {
        startPage();
        List<WcfRegionManageInfo> list = wcfRegionManageInfoService.selectWcfRegionManageInfoList(wcfRegionManageInfo);
        return getDataTable(list);
    }

    /**
     * 导出功能区内容管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:export')")
    @Log(title = "功能区内容管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfRegionManageInfo wcfRegionManageInfo)
    {
        List<WcfRegionManageInfo> list = wcfRegionManageInfoService.selectWcfRegionManageInfoList(wcfRegionManageInfo);
        ExcelUtil<WcfRegionManageInfo> util = new ExcelUtil<WcfRegionManageInfo>(WcfRegionManageInfo.class);
        return util.exportExcel(list, "功能区内容管理数据");
    }

    /**
     * 获取功能区内容管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:query')")
    @GetMapping(value = "/{infoId}")
    public AjaxResult getInfo(@PathVariable("infoId") Long infoId)
    {
        return AjaxResult.success(wcfRegionManageInfoService.selectWcfRegionManageInfoByInfoId(infoId));
    }

    /**
     * 新增功能区内容管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:add')")
    @Log(title = "功能区内容管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfRegionManageInfo wcfRegionManageInfo)
    {
        return toAjax(wcfRegionManageInfoService.insertWcfRegionManageInfo(wcfRegionManageInfo));
    }

    /**
     * 修改功能区内容管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:edit')")
    @Log(title = "功能区内容管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfRegionManageInfo wcfRegionManageInfo)
    {
        return toAjax(wcfRegionManageInfoService.updateWcfRegionManageInfo(wcfRegionManageInfo));
    }

    /**
     * 删除功能区内容管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRegionManageInfo:remove')")
    @Log(title = "功能区内容管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{infoIds}")
    public AjaxResult remove(@PathVariable Long[] infoIds)
    {
        return toAjax(wcfRegionManageInfoService.deleteWcfRegionManageInfoByInfoIds(infoIds));
    }

    /**
     * 查询功能区管理列表
     */
    @GetMapping("/wcfRegionManageList")
    public TableDataInfo wcfRegionManageList()
    {
        startPage();
        WcfRegionManage wcfRegionManage = new WcfRegionManage();
        wcfRegionManage.setDelFlag(0);
        List<WcfRegionManage> list = wcfRegionManageService.selectWcfRegionManageList(wcfRegionManage);
        return getDataTable(list);
    }
}
